package com.qdu.servlet;

import com.qdu.dao.ActivityDao;
import com.qdu.entity.Activity;
import com.qdu.entity.Log;
import com.qdu.service.impl.LogServiceImpl;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 在发表日志页面之前获取活动信息的servlet
 *
 * @author Lenovo
 */
@WebServlet("/bpls")
public class beforePublishLogServlet extends HttpServlet{

    ActivityDao act=new ActivityDao();
    LogServiceImpl logserviceimpl=new LogServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       
        String id=req.getParameter("id");//获取活动id
        Activity activity=act.GetActiveInfoByIdIncludeCover(id);
        
        List<Log> list=logserviceimpl.getAllLog();//获取所有日志
        req.setAttribute("activity",activity);
        req.setAttribute("list", list);
        
        req.getRequestDispatcher("publishLog.jsp").forward(req, resp);
    }

    
}
